<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <base th:href="@{/}">
    <title>Thymeleaf示例</title>
    <!-- import CSS -->
    <link rel="stylesheet" th:href="@{/css/default.css}"/>
    <script th:src="@{/js/jquery-3.7.1.js}"></script>
    <script th:src="@{/js/demo.js}"></script>
</head>
<body>
    <div>111
        <h1 th:text="${message}">000</h1>
        <img class="images" th:src="@{${imageFile}}" />
        <input id="msg" type="text" th:value="${message}"/>
        <input id="btn" type="button" value="提交" />
    </div>
</body>
<script type="text/javascript">
    $(function () {

        let memoryArrTest = function() {
            console.log($.isEmptyObject(str));
            var str = null;
            console.log($.isEmptyObject(str));
            str = "";
            console.log($.isEmptyObject(str));
            str = " ";
            console.log($.isEmptyObject(str));

            let arr = new Array();
            for (let i = 0; i < 100000; i++) {
                arr.push(i);
            }
            console.log(arr);
            arr.unshift(0.001);

            console.log(arr);
        }

        let dateTest = function() {
            let str = '["2024-04-16T16:00:00.000Z","2024-04-16T16:00:00.000Z","2024-04-16T16:00:00.000Z","2024-04-17T16:00:00.000Z","2024-05-06T16:00:00.000Z","2024-05-10T16:00:00.000Z","2024-06-16T16:00:00.000Z","2024-06-18T16:00:00.000Z","2024-07-08T16:00:00.000Z","2024-07-31T16:00:00.000Z","2024-07-31T16:00:00.000Z","2024-07-31T16:00:00.000Z", "2024-08-05T16:00:00.000Z","2024-08-07T16:00:00.000Z","2024-08-09T16:00:00.000Z","2024-08-11T16:00:00.000Z","2024-08-13T16:00:00.000Z","2024-08-13T16:00:00.000Z","2024-08-14T16:00:00.000Z","2024-08-14T16:00:00.000Z","2024-08-14T16:00:00.000Z","2024-08-18T16:00:00.000Z", "2024-08-19T16:00:00.000Z","2024-08-27T16:00:00.000Z","2024-08-29T16:00:00.000Z"]';
            let arr = JSON.parse(str);
            $.each(arr, function(index, item) {
                let d = new Date(item);
                console.log(item);
                console.log(d.getFullYear() + " --- " + (d.getMonth() + 1) + " --- " + d.getDate());
                console.log("======================================================================");
            });
        }

        let mapLoopTest = function() {
            let laoda = new Map([
                ["name", "老大"],
                ["gender", "男"],
                ["web", "https://www.laoda.com"]
            ]);

            laoda.forEach((v, k) => {
                if (k.includes('name')) {
                    console.log(k + ' -|||- ' + v);
                }
            });
            $.each(laoda, function(k, v) {
                if (k.includes('name')) {
                    console.log(k + ' -===- ' + v);
                }
            });
        }

        let undefinedTest = function() {
            let arr = [1, 2, 3];
            let item = arr[9];
            console.log(item);
            if ( typeof(item) === "undefined") {
                console.log('ok');
            }
        }

        $('#btn').click(function() {
            alert(0);
            // mapLoopTest();
            let d = new Demo(11);
            console.log(d.get());
            d.free();
        });

        let onResize = function(event, number) {
            console.log(event);
        }

        $(window).bind('resize', 111, onResize);

    });
</script>
</html>